Skip to content

feat(app): add a duration heatmap view to trace search - #3184

Open
alex-fedotyev wants to merge 7 commits into
alex/red-metrics-trace-search-v2from
alex/trace-search-duration-heatmap
Open

alex-fedotyev wants to merge 7 commits into
alex/red-metrics-trace-search-v2from
alex/trace-search-duration-heatmap

Conversation

@alex-fedotyev

@alex-fedotyev alex-fedotyev commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Stack

Layer 2 of 2 in a GitHub stack (stack #3688). GitHub shows this PR's base as alex/red-metrics-trace-search-v2, the branch below it, but the stack's base is main: merging this PR lands it and #3183 on main, one squashed commit each. Its diff is only the heatmap layer, and CI runs as if it targets main:

  1. feat(app): show RED metrics on the trace search results view #3183 RED metrics on the trace search results view
  2. feat(app): add a duration heatmap view to trace search #3184 Duration heatmap view for trace search (this PR)

Summary

Adds a RED/Heatmap switch to the trace search results view. Heatmap replaces the three RED tiles with the duration distribution over time, as the same bare heatmap tile the dashboard renders (DBHeatmapChart with a toHeatmapQuery query), without the significant-fields comparison panel.

  • The choice lives in the URL as traceChartMode, like the other view toggles on this page, so a reload, a shared link, or Back/Forward reopens the same view. Picking a different source in the dropdown resets it to RED, so returning to a trace source after viewing another one doesn't silently reopen in Heatmap and switch live tail off again. The reset waits until the URL points at the new source, like the page's filter and group-by reconciles, so it lands on the new history entry, and it clears the param rather than writing red into every URL.
  • The heatmap plots getDurationMsExpression (the source's duration scaled to ms by its durationPrecision) with the existing HEATMAP_DURATION_NUMBER_FORMAT, the same pairing the delta-view heatmap uses. Value, count and scale are fixed rather than read from that view's settings drawer, so this stays a plain duration heatmap independent of the delta view's query state.
  • DBHeatmapChart is used as is. The heatmap needs no query namespace of its own: live tail is off whenever it shows, so no tick can stack its queries.
  • Live tail stays off while the heatmap is the visible chart, the way delta and pattern modes keep it off: the TimePicker's Live option and the Resume Live Tail button are hidden, and a guard turns live tail back off if anything else turns it on, so a "Live tail ranges" pick lands on a fixed range. A tick moves the absolute time range, and the heatmap keys its uPlot instance on the chart config, so each refresh would otherwise tear the chart down and rebuild it with a recomputed y-axis. The guard lives in useHeatmapLiveTailGuard.
  • The switch only appears where the RED tiles render: a trace source with a duration column, a non-compact viewport, and no custom group-by (those fall back to the histogram). The chart branch, the switch and the live-tail pin read one derived source, so they can't disagree about which chart is showing, and a stale ?traceChartMode=heatmap can't disable live tail on a search that shows the histogram.

Screenshots

Light theme:

heatmap light

Dark theme:

heatmap dark

Test plan

  • useHeatmapLiveTailGuard tests cover the guard: off when the heatmap appears, off again when resumed under it, untouched on RED.
  • tsc --noEmit, eslint with no new warnings, knip, and the traceRedMetrics, DBTimeChart and DBSearchPage suites green against current main.
  • Verified on this PR's Vercel preview against the demo traces dataset, in light and dark: Heatmap renders the duration distribution and turns live tail off, with Resume Live Tail and the TimePicker's Live option hidden; a "Live tail ranges" pick under it lands on a fixed range that holds still across refresh intervals; switching back to RED offers Resume Live Tail again; the mode survives a reload; picking a Logs source hides the switch and clears traceChartMode, coming back to traces resets to RED, and Back from Logs returns to the heatmap (as do Forward and Back after it); a custom group-by and a compact (390px) viewport fall back to the histogram with the switch hidden. The heatmap shows Loading while its queries are in flight and "Not enough data points" for a WHERE that matches nothing, and a failed search query hides the chart area and shows the query error.

Notes

@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hyperdx-oss Ready Ready Preview Nov 17, 2026 3:26am UTC
hyperdx-storybook Ready Ready Preview Nov 17, 2026 3:26am UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8c2175f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Minor
@hyperdx/api Minor
@hyperdx/otel-collector Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no outstanding correctness or repository-rule violations identified.

Summary

Adds a URL-backed RED/Heatmap switch to trace search and renders duration distributions using the shared dashboard heatmap implementation.

  • Resets the selected chart mode when the active source changes while preserving shared heatmap links on initial load.
  • Pauses live tail while the heatmap is visible and namespaces both heatmap queries with the search chart prefix.
  • Centralizes duration-heatmap formatting and separates span-status error predicates from log-severity handling.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Trace search results] --> B{traceChartMode}
    B -->|RED| C[Throughput, errors, duration]
    B -->|Heatmap| D[Duration heatmap]
    D --> E[Min/max query]
    E --> F[Bucket query]
    C --> G[Shared query-key prefix]
    D --> G
    G --> H[Search fetching gate]
    H --> I[Live-tail coordination]
Loading

Reviews (4) · Last reviewed commit: "fix(app): pin live tail off while the tr..."

Comment thread packages/app/src/DBSearchPage.tsx Outdated
// (undefined -> id) doesn't count as a change and a shared link that pins
// ?traceChartMode=heatmap survives.
const prevSourceIdRef = useRef<string | undefined>(undefined);
useEffect(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — Reset effect discards the user's Heatmap choice even when the new source can render it

The effect fires on any searchedSource?.id change, so switching from trace source A to trace source B — both with a durationExpression, so both render the toggle via traceRedMetricsSource — silently flips the view back to RED. The sibling view toggle analysisMode (:1067) is deliberately not reset on source change even though delta needs a trace source too; that branch just renders nothing (:2637). Drop the effect (both the switch and the chart are already hidden when traceRedMetricsSource == null, so a lingering ?traceChartMode=heatmap is inert), or gate the reset on the new source not supporting the heatmap.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping a reset, but since 364e04c and 8c2175f it only runs for a source the user picks, not on every source id change. A lingering ?traceChartMode=heatmap isn't inert: coming back to a trace source would reopen the heatmap and switch live tail off again. Back/Forward keeps whatever mode the URL restores.

Comment thread packages/app/src/DBSearchPage.tsx Resolved
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

PR Review

If you are a coding agent acting for the author, read this first.
Nothing below blocks merge automatically; a maintainer decides. What they will expect:

  • 🔴 critical or 🟠 major in code this PR adds or changes: fix before asking for review.
  • 🔵 minor in code this PR changes: your call. Fix if small, otherwise reply.
  • Anything about surrounding code, or asking you to widen the change (hoist a helper,
    dedupe with another file, fix other call sites): never fix here, whatever the
    severity. Reply with one sentence; if it is critical, say so plainly so a human sees it.

One commit per review round. After two rounds, stop and ask a maintainer to review
scope rather than addressing more automated findings. Full rule: AGENTS.md.

5 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 5 minor

3 posted as inline comment(s) on the changed lines. 2 listed below.

Findings outside the changed lines

2 minor
  • 🔵 packages/app/src/components/Search/TraceRedMetricsChart.tsx:342 — Drag-to-zoom stops working in Heatmap mode → TraceRedMetricsChart receives onTimeRangeSelect, and the RED tiles and the fallback histogram use it for drag-to-zoom. The heatmap branch renders DBHeatmapChart without onFilter, so dragging across the heatmap does nothing. Pass an onFilter that converts xMin/xMax into onTimeRangeSelect(new Date(...), new Date(...)), so the time range can be narrowed the same way in both views.
  • 🔵 packages/app/src/components/Search/TraceRedMetricsChart.tsx:339 — Heatmap view is placed inside the RED component, which now takes props it ignores in each mode → In heatmap mode, TraceRedMetricsChart still builds the RED configs and receives histogramTimeChartConfig, queryKeyPrefix, throughputQueryKeyPrefix and onFocusSeries, none of which it uses. In RED mode, heatmapChartConfig is required but unused. Render the heatmap tile as a sibling in DBSearchPage's chart branch (or in a TraceHeatmapTile component) chosen by traceChartMode. Alternatively, make the props a discriminated union on mode.

Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides.

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Deep Review

✅ No critical (P0/P1) issues found in the reviewer results available at synthesis time.

The change is a self-contained, URL-backed view toggle. The strongest signal is a behavioral divergence between the live-tail guard condition and the actual chart-render gate, plus missing tests for the new source-reset logic.

🟡 P2 — recommended

  • packages/app/src/DBSearchPage.tsx:2157 — isHeatmapChartVisible omits the traceHeatmapChartConfig != null guard that the render branch uses, so while chartConfig == null (heatmap selected) the histogram fallback renders yet live tail is forced off and the Live option and Resume button are hidden, contradicting the code's own "only while the heatmap is actually rendered" comment.
    • Fix: Derive isHeatmapChartVisible from the same gate as the render branch by including traceHeatmapChartConfig != null, or fold that null-check into traceChartsSource so both read one condition.
    • maintainability, testing
  • packages/app/src/DBSearchPage.tsx:1571 — the source-change RED reset (pendingTraceChartModeResetRef effect) has no test, and the useTraceChartModeGuards suite the PR description references does not exist in the repo, leaving the reset's branching (real switch clears, first-source-resolve keeps, same source keeps, Back/Forward never reset) unverified.
    • Fix: Add a render-level test via the existing DBSearchPage harness (or extract the reset into a testable hook) asserting the traceChartMode URL-param transitions across those cases.
    • testing
🔵 P3 nitpicks (1)
  • packages/app/src/DBSearchPage.tsx:2157 — the isHeatmapChartVisible derivation is only asserted at the hook boundary (raw boolean), so the stale-?traceChartMode=heatmap-on-histogram and not-in-results-mode cases that must not disable live tail go untested.
    • Fix: Cover the false-when-histogram and false-when-not-results cases at the point the condition is computed.

Reviewers (5): correctness-set reviewers returned partial coverage; results incorporated from testing, maintainability, project-standards, agent-native, learnings-researcher.

Coverage note: 7 of 12 dispatched reviewers (correctness, performance, api-contract, adversarial, previous-comments, kieran-typescript, julik-frontend-races) had not returned results when synthesis was forced, so the async-race, type-safety, query-performance, and prior-comment dimensions are not reflected below. Project-standards found no violations (changeset minor bump, import ordering, test placement all conform). Agent-native: PASS — the toggle's full state lives in the traceChartMode URL param, so the Heatmap view is programmatically reachable and shareable. Learnings: no applicable prior solutions (no app-scoped docs/solutions/).

Testing gaps: TraceRedMetricsChart has no test file, so the new mode === 'heatmap' render branch and the heatmapQuery memo (duration-ms expression, log scale, HEATMAP_DURATION_NUMBER_FORMAT) are unverified; the SegmentedControl onChange fallback (… ?? 'red') defensive branch is also untested.

No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond

Comment thread packages/app/src/DBSearchPage.tsx Resolved
Comment thread packages/app/src/DBSearchPage.tsx Resolved
Comment thread packages/app/src/DBSearchPage.tsx Resolved
Comment thread packages/app/src/DBSearchPage.tsx Resolved
Comment thread packages/app/src/DBSearchPage.tsx Outdated
// can't disable live tail for a search that shows the histogram.
const isHeatmapChartVisible =
analysisMode === 'results' &&
traceRedMetricsSource != null &&

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — Switching back to RED leaves live tail off

The pin writes isLive=false into the URL, and nothing restores it. A user who looks at the heatmap for a moment and switches back to RED is left on a frozen time range with live tail off. Pausing live updates through useLiveUpdate's pause while the heatmap is visible, instead of overwriting isLive, would bring live tail back when the user switches to RED.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intended: delta and pattern modes turn live tail off the same way, and pausing instead would leave the TimePicker and the results count claiming live tail over a frozen range. Back on RED, Resume Live Tail brings it back in one click.

Comment thread packages/app/src/DBSearchPage.tsx Resolved
Comment thread packages/app/src/DBSearchPage.tsx Resolved
kodiakhq Bot pushed a commit that referenced this pull request Sep 25, 2026
…3221)

## Summary

Fixes the heatmap part of #3205: during a dashboard refresh, heatmap tiles now keep the current heatmap on screen and pulse, instead of replacing it with "Loading...".

- Both heatmap queries (the min/max bounds and the buckets) keep their previous result as placeholder data, the same way the time chart and the number, bar and pie tiles do.
- The bucket query waits for the refreshed bounds before it runs, so a refresh doesn't also query the new range bucketed with the previous range's min/max.
- The heatmap, and the "Not enough data points" message, pulse while either query is still showing previous data. `Heatmap` takes an optional `className` so the pulse goes on its existing container rather than a new wrapper, which would affect its size measurement.
- New tests in `DBHeatmapChart.render.test.tsx`: both queries keep their previous data, the tile pulses during a refresh and stops once fresh data loads, and the bucket query waits for fresh bounds. Three of the four fail without the change.

While checking the rest of the app for the same pattern, I found two more places: the Kubernetes dashboard's Pods, Nodes and Namespaces tables still switch to skeleton rows on every refresh, and the Services dashboard tiles (`DBListBarChart`, `DBHistogramChart`, the slowest events tile) keep their data but don't pulse. Happy to take those as follow-ups if you'd like.

### How to test on Vercel preview

**Preview routes:** /dashboards

**Steps:**

1. Create a dashboard with a Heatmap tile on the demo traces source (for example on `Duration`) and a Line time chart.
2. Choose a large time range so each query takes a moment.
3. Click "Refresh dashboard".
4. Verify the heatmap stays on screen and pulses while its queries run, like the line chart, and stops pulsing once the new heatmap appears.

### References

- Linear Issue: N/A
- Related PRs: #3211, #3212. #3184 also edits the `queryKey` of these two heatmap queries, so whichever lands second needs a small rebase.
- Closes part of #3205

Checks run locally: `jest` for the heatmap suites and `ChartPreviewPanel` (50 passed), `eslint` on changed files (0 errors, no new warnings), `prettier --check`, and `tsc --noEmit` for `packages/app`.
@alex-fedotyev
alex-fedotyev requested a review from a team as a code owner November 13, 2026 23:40
@alex-fedotyev
alex-fedotyev force-pushed the alex/trace-search-duration-heatmap branch from 46b3d9e to 5809452 Compare November 17, 2026 02:00
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

E2E Test Results

✅ All tests passed • 467 passed • 1 skipped • 1003s

Status Count
✅ Passed 467
❌ Failed 0
⚠️ Flaky 1
⏭️ Skipped 1

Tests ran across 4 shards in parallel.

View full report →

? histogramTimeChartConfig.groupBy.length > 0
: false;

if (mode === 'heatmap') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — The new heatmap branch of TraceRedMetricsChart has no test

Add a component test that renders mode="heatmap" and checks that DBHeatmapChart gets a distribution query whose value is getDurationMsExpression(source), uses HEATMAP_DURATION_NUMBER_FORMAT and log scale, and receives queryKeyPrefix. Today only the guard hook and useHeatmapData keys are tested, so a wrong expression or format here would still pass (there is no TraceRedMetricsChart test under components/Search/__tests__/).

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not adding a component test here: the branch is checked on the preview (duration value, ms format, log scale), and e2e for the view, which covers it end to end, is tracked in #3176.

// the search's chart config over the searched range, carrying the source's
// select-alias definitions. Memoized so the tile's query stays stable across
// re-renders.
const traceHeatmapChartConfig = useMemo(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — traceHeatmapChartConfig duplicates the delta heatmap's inline config

The delta-mode DBSearchHeatmapChart (DBSearchPage.tsx:2908-2912) builds the same {...chartConfig, dateRange: searchedTimeRange, with: aliasWith} object inline on every render. Pass the memoized traceHeatmapChartConfig there too (renamed to something like heatmapBaseChartConfig) so the base config has one source of truth.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would change the delta view's code path, which this PR otherwise leaves alone, so I'm keeping it out of this PR.

Comment thread packages/app/src/DBSearchPage.tsx Resolved
@alex-fedotyev
alex-fedotyev force-pushed the alex/trace-search-duration-heatmap branch from 3f41fe6 to 7cae7bb Compare November 17, 2026 02:45
@github-actions github-actions Bot added review/tier-3 Standard — full human review required and removed review/tier-2 Low risk — AI review + quick human skim labels Nov 17, 2026
? histogramTimeChartConfig.groupBy.length > 0
: false;

if (mode === 'heatmap') {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — TraceRedMetricsChart now renders two unrelated views behind a mode early return

In heatmap mode the component still computes the RED configs and receives props it doesn't use (onFocusSeries, throughputQueryKeyPrefix, histogram config). In RED mode it needs heatmapChartConfig, and DBSearchPage now gates the RED tiles on traceHeatmapChartConfig != null. This breaks the Single Responsibility convention. Fix: add a separate small TraceDurationHeatmapChart and pick between the two in DBSearchPage on traceChartMode. TraceRedMetricsChart then stays RED-only.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keeping one component: both views take the same search config, source and ready state, and the page picks the view in one place. A second component would carry the same props without changing behavior.

<SegmentedControl
size="xs"
value={traceChartMode}
onChange={v =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — Switch options are hand-written rather than derived from TRACE_CHART_MODES, and the ?? 'red' fallback never runs

TRACE_CHART_MODES says the view switch reads from it, but the data array lists 'red'/'heatmap' as literals. A new mode added to the list would parse from the URL but never appear in the switch. SegmentedControl only emits values from data, so the find(...) ?? 'red' fallback is dead code. Fix: build data from TRACE_CHART_MODES with a Record<TraceChartMode, string> label map, and narrow v with that list.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback narrows find's possibly-undefined result for the type. A new mode also needs its label in the switch, which sits next to the handler, so I left the two entries inline rather than add a label map.

alex-fedotyev and others added 6 commits November 17, 2026 03:15
Adds a RED/Heatmap switch to the trace results chart area. Heatmap renders
the duration distribution over time as the same tile the dashboard does. The
mode is URL state, so a reload or a shared link reopens the same view, and it
resets to RED when the source changes.

The heatmap's bounds and bucket queries take the search's RED query-key
prefix (DBHeatmapChart gains the queryKeyPrefix prop DBTimeChart already
has; keys are unchanged for callers that don't pass one), so live tail waits
on them instead of stacking a fresh pair each tick. Live tail is also pinned
off while the heatmap is the visible chart: a tick moves the absolute time
range, and the heatmap keys its uPlot instance on the chart config, so each
refresh would otherwise tear the chart down and rebuild it.

The switch, the chart branch and the live-tail pin share one derived source,
so the heatmap renders (and pins live tail) only where the RED tiles would: a
trace source with a duration column, a non-compact viewport, and no custom
group-by.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The live-tail pin only ran when the heatmap first appeared, so Resume
Live Tail (or the TimePicker's Live option) turned live tail back on
while the heatmap was still showing, and every tick rebuilt the chart.

- Hide the TimePicker's Live option and the Resume Live Tail button while
  the heatmap is the visible chart, the way delta and pattern modes hide
  them, and make the guard check isLive so any other path that turns live
  tail on (a relative range pick) is switched off again.
- Move the source-change reset and the live-tail guard into
  useTraceChartModeGuards, with tests for first load, a real source
  switch, and resuming live tail under the heatmap.
- Drop the @source tag on the heatmap query in favor of a plain note,
  and document that queryKeyPrefix only applies to distribution heatmaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
nuqs 1.x writes an explicitly set default into the URL, so resetting the
trace chart mode with 'red' added ?traceChartMode=red on every source
switch, log sources included. Clear the param instead; the mode still
falls back to RED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mode union lived in TraceRedMetricsChart and a hand-written copy in
the URL parser, so a mode added to the type alone would compile but parse
back to RED. Export TRACE_CHART_MODES, derive TraceChartMode from it, and
use it in the parser and the view switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The prefix let live tail wait on the heatmap queries, but live tail is
always off while the heatmap is the visible chart, so it never changed
anything. It did give these queries different keys from the identical
delta-view heatmap. Without it, DBHeatmapChart and useHeatmapData go
back to their current shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reset ran in an effect on the searched source id, so it also fired
when Back or Forward restored a URL with traceChartMode=heatmap, and
rewrote that history entry back to RED. Clear the mode in the page's
existing user-source-change branch instead, which catch-up (history
navigation, a source name resolving) already skips. The hook keeps only
the live-tail guard, renamed useHeatmapLiveTailGuard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alex-fedotyev
alex-fedotyev force-pushed the alex/trace-search-duration-heatmap branch from 7cae7bb to 364e04c Compare November 17, 2026 03:18
@github-actions github-actions Bot added review/tier-2 Low risk — AI review + quick human skim and removed review/tier-3 Standard — full human review required labels Nov 17, 2026
Comment thread packages/app/src/DBSearchPage.tsx Outdated
// off again). Cleared rather than set to 'red': nuqs 1.x writes an
// explicit default into the URL. Catch-up skips this branch, so
// Back/Forward keeps the mode the URL restores.
setTraceChartMode(null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — The rule that resets traceChartMode on a source change has no test, and the PR description says it does

The reset moved inline into the source-change effect, and only the live-tail guard has tests now. The PR description still lists useTraceChartModeGuards reset tests and a DBHeatmapChart queryKeyPrefix with useHeatmapData tests, none of which are in this diff. Add DBSearchPage tests for three cases: a user-picked source clears traceChartMode, a catch-up from source name to ID keeps it, and a saved-search load keeps it. Update the description to match.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description is updated and no longer lists those tests or the prefix. The reset has no page-level unit test; I checked it on the preview (a picked source clears the mode, Back/Forward keeps it), and e2e for the view is tracked in #3176.

Comment thread packages/app/src/DBSearchPage.tsx Resolved
Comment thread packages/app/src/DBSearchPage.tsx Resolved
Comment thread packages/app/src/DBSearchPage.tsx Resolved
Clearing the mode from the dropdown branch ran before the debounced
search submit pushed the new source, so it rewrote the previous history
entry, and Back still landed on RED. Mark the reset as pending there, like
the filter and group-by reconciles, and clear the mode once the URL points
at the new source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chartConfig == null
? undefined
: ({
...chartConfig,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 minor — Heatmap config keeps the results table's orderBy, so sorting a column rebuilds the heatmap

Add orderBy: undefined to traceHeatmapChartConfig, the way histogramTimeChartConfig and filtersChartConfig do. The heatmap's query keys already drop orderBy (buildHeatmapBoundsConfig/buildHeatmapBucketConfig in DBHeatmapChart/heatmapQueries.ts). But DistributionHeatmapChart sets plotKey={JSON.stringify(query.config)}, and that string still contains the search's orderBy. So clicking a sort header (onSortingChange → setSearchedConfig({orderBy})) changes chartConfig, which tears down and recreates the uPlot instance even though the data hasn't changed. That is the same rebuild this PR's live-tail guard comment is trying to avoid.

Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right: sorting the results table changes the plotKey and remounts the heatmap. The fix is orderBy: undefined on traceHeatmapChartConfig, as histogramTimeChartConfig does. I'm leaving it to the reviewer's call on scope rather than another round here.

Comment thread packages/app/src/DBSearchPage.tsx Resolved
Comment thread packages/app/src/DBSearchPage.tsx Resolved

This branch was successfully deployed

2 active deployments
Preview – hyperdx-oss — 8c2175fe Deployed Nov 17, 2026 by vercel[bot]
Preview – hyperdx-storybook — 8c2175fe Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/tier-2 Low risk — AI review + quick human skim

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant